package org.jeecg.common.util.constants;

import lombok.extern.slf4j.Slf4j;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

import static org.jeecg.common.util.constants.WxConstants.DOCTOR_QRCODE_TEMPLATE;
import static org.jeecg.common.util.constants.WxConstants.WX_QR_CODE_URL;

/**
 * @author guoyh
 * @ClassName WxConstantsUtil
 * @Description
 * @since 2020/8/16 15:37
 **/
@Slf4j
public class WxConstantsUtil {

    public static String getDoctorQrCodeSceneId(String doctorId){
        return String.format(DOCTOR_QRCODE_TEMPLATE,doctorId);
    }

    public static String getQrCodeUrl(String ticket){
        try {
            ticket = URLEncoder.encode(ticket,"utf-8");
        } catch (UnsupportedEncodingException e) {
            log.error("URLEncode error,ticket:{}",ticket,e);
        }
        return String.format(WX_QR_CODE_URL,ticket);
    }
}
